"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const path = require("path");
class Pkg {
    constructor() {
        this.name = "";
        this.version = "1.0.0";
        this.homepage = ".";
        this.main = "index.js";
        this.license = "MIT";
        this.scripts = {};
        this.dependencies = {};
        this.devDependencies = {};
    }
    static get instance() {
        if (Pkg._instance) {
            return Pkg._instance;
        }
        Pkg._instance = new Pkg();
        return Pkg._instance;
    }
    /**
     * 注入dependencies、devDenpendencies
     * @param name 特性名
     */
    injectPrompt(name) {
        const data = require(path.join(__dirname, `../prompt/${name}.js`));
        this.dependencies = Object.assign({}, this.dependencies, data.dependencies);
        this.devDependencies = Object.assign({}, this.devDependencies, data.devDependencies);
    }
    toJSON() {
        const json = {};
        json.name = this.name;
        json.version = this.version;
        json.homepage = this.homepage;
        json.main = this.main;
        json.license = this.license;
        json.scripts = this.scripts;
        json.dependencies = this.dependencies;
        json.devDependencies = this.devDependencies;
        return json;
    }
}
Pkg._instance = new Pkg();
exports.default = Pkg;
